﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbMlineStyle : OdDbObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbMlineStyle(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbMlineStyle_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbMlineStyle obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbMlineStyle()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbMlineStyle(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbMlineStyle cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbMlineStyle_cast(OdRxObject.getCPtr(pObj));
			OdDbMlineStyle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbMlineStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbMlineStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbMlineStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbMlineStyle_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbMlineStyle_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbMlineStyle_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbMlineStyle createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbMlineStyle_createObject();
			OdDbMlineStyle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbMlineStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbMlineStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbMlineStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void initMlineStyle()
		{
			TD_DbPINVOKE.OdDbMlineStyle_initMlineStyle(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void set(OdDbMlineStyle source, bool checkIfReferenced)
		{
			TD_DbPINVOKE.OdDbMlineStyle_set__SWIG_0(this.swigCPtr, OdDbMlineStyle.getCPtr(source), checkIfReferenced);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void set(OdDbMlineStyle source)
		{
			TD_DbPINVOKE.OdDbMlineStyle_set__SWIG_1(this.swigCPtr, OdDbMlineStyle.getCPtr(source));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setDescription(string description)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setDescription(this.swigCPtr, description);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string description()
		{
			string result = TD_DbPINVOKE.OdDbMlineStyle_description(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setName(string name)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setName(this.swigCPtr, name);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public string name()
		{
			string result = TD_DbPINVOKE.OdDbMlineStyle_name(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setShowMiters(bool showThem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setShowMiters(this.swigCPtr, showThem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool showMiters()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_showMiters(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setStartSquareCap(bool showThem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setStartSquareCap(this.swigCPtr, showThem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool startSquareCap()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_startSquareCap(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setStartRoundCap(bool showThem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setStartRoundCap(this.swigCPtr, showThem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool startRoundCap()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_startRoundCap(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setStartInnerArcs(bool showThem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setStartInnerArcs(this.swigCPtr, showThem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool startInnerArcs()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_startInnerArcs(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setEndSquareCap(bool showThem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setEndSquareCap(this.swigCPtr, showThem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool endSquareCap()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_endSquareCap(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setEndRoundCap(bool showThem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setEndRoundCap(this.swigCPtr, showThem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool endRoundCap()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_endRoundCap(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setEndInnerArcs(bool showThem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setEndInnerArcs(this.swigCPtr, showThem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool endInnerArcs()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_endInnerArcs(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setFillColor(OdCmColor fillColor)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setFillColor(this.swigCPtr, OdCmColor.getCPtr(fillColor));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdCmColor fillColor()
		{
			OdCmColor result = new OdCmColor(TD_DbPINVOKE.OdDbMlineStyle_fillColor(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setFilled(bool filled)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setFilled(this.swigCPtr, filled);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool filled()
		{
			bool result = TD_DbPINVOKE.OdDbMlineStyle_filled(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setStartAngle(double startAngle)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setStartAngle(this.swigCPtr, startAngle);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double startAngle()
		{
			double result = TD_DbPINVOKE.OdDbMlineStyle_startAngle(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setEndAngle(double endAngle)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setEndAngle(this.swigCPtr, endAngle);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double endAngle()
		{
			double result = TD_DbPINVOKE.OdDbMlineStyle_endAngle(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int addElement(double offset, OdCmColor color, OdDbObjectId linetypeId, bool checkIfReferenced)
		{
			int result = TD_DbPINVOKE.OdDbMlineStyle_addElement__SWIG_0(this.swigCPtr, offset, OdCmColor.getCPtr(color), OdDbObjectId.getCPtr(linetypeId), checkIfReferenced);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public int addElement(double offset, OdCmColor color, OdDbObjectId linetypeId)
		{
			int result = TD_DbPINVOKE.OdDbMlineStyle_addElement__SWIG_1(this.swigCPtr, offset, OdCmColor.getCPtr(color), OdDbObjectId.getCPtr(linetypeId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void removeElementAt(int elem)
		{
			TD_DbPINVOKE.OdDbMlineStyle_removeElementAt(this.swigCPtr, elem);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public int numElements()
		{
			int result = TD_DbPINVOKE.OdDbMlineStyle_numElements(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setElement(int elementIndex, double offset, OdCmColor color, OdDbObjectId linetypeId)
		{
			TD_DbPINVOKE.OdDbMlineStyle_setElement(this.swigCPtr, elementIndex, offset, OdCmColor.getCPtr(color), OdDbObjectId.getCPtr(linetypeId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getElementAt(int elementIndex, out double offset, OdCmColor color, OdDbObjectId linetypeId)
		{
			TD_DbPINVOKE.OdDbMlineStyle_getElementAt(this.swigCPtr, elementIndex, out offset, OdCmColor.getCPtr(color), OdDbObjectId.getCPtr(linetypeId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbMlineStyle_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbMlineStyle_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbMlineStyle_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbMlineStyle_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdResult subGetClassID(IntPtr pClsid)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbMlineStyle_subGetClassID(this.swigCPtr, pClsid);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void appendToOwner(OdDbIdPair idPair, OdDbObject pOwnerObject, OdDbIdMapping ownerIdMap)
		{
			TD_DbPINVOKE.OdDbMlineStyle_appendToOwner(this.swigCPtr, OdDbIdPair.getCPtr(idPair), OdDbObject.getCPtr(pOwnerObject), OdDbIdMapping.getCPtr(ownerIdMap));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
